<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新建登记</title>
    <link rel="stylesheet" href="../../../../component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">养老机构</label>
                <div class="layui-input-block">
                    <input type="text" name="pensionInstitution"  value="" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">档案编号</label>
                <div class="layui-input-block">
                    <input type="text" name="docNum"  value="" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="patientName" value=""   lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input readonly type="text" name="patientSex"   autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">年龄</label>
                <div class="layui-input-block">
                    <input type="number" name="patientAge"  value="" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">


            <div class="layui-inline">
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-block">
                    <input type="date" name="patientBirth" value=""  lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">证件号</label>
                <div class="layui-input-block">
                    <input type="text" name="patientCardId" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">现住地址</label>
                <div class="layui-input-block">
                    <input type="text" name="patientAddress"  style="width: 400px" value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>


        </div>
        <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">户口地址</label>
            <div class="layui-input-block">
                <input type="text" name="patientAccountAddress" style="width: 400px" value=""    placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        </div>
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">监护人</label>
                <div class="layui-input-block">
                    <input type="text" name="guardian"   value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">监护人电话</label>
                <div class="layui-input-block">
                    <input type="text" name="guardianTel" value=""    placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">担保人</label>
                <div class="layui-input-block">
                    <input type="text" name="guardian"   value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">担保人电话</label>
                <div class="layui-input-block">
                    <input type="text" name="guardianTel" value=""    placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">服务类型</label>
                <div class="layui-input-block">
                    <input type="text" name="serviceType"  value=""   placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">护理级别</label>
                <div class="layui-input-block">
                    <input type="text" name="careLevel"  value="" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">护工</label>
                <div class="layui-input-block">
                    <input type="text" name="caregivers" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">责任护士</label>
                <div class="layui-input-block">
                    <input type="text" name="nurse" value=""   autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">主管医师</label>
                <div class="layui-input-block">
                    <input type="text" name="doctor" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">床位区域</label>
                <div class="layui-input-block">
                    <input type="text" name="bedArea" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">房间号</label>
                <div class="layui-input-block">
                    <input type="text" name="roomNum"  value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">床位号</label>
                <div class="layui-input-block">
                    <input type="text" name="bedNum" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">入院诊断</label>
                <div class="layui-input-block">
                    <textarea  type="text" name="inpatientsDiagnosis" value=""  placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">入住原因</label>
                <div class="layui-input-block">
                    <textarea  type="text" name="inpatientsReason" value=""  placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">支付方式</label>
                <div class="layui-input-block">
                    <input type="text" name="payWay"  value=""   placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">预存金额</label>
                <div class="layui-input-block">
                    <input type="text" name="preMoney"  value=""   placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>


    </div>
    </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="../../../../component/layui/layui.js"></script>
<script src="../../../../component/pear/pear.js"></script>
<script>
    layui.use(['form','jquery'],function(){
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(user-save)', function(data){

            console.log(data.field)
            $.ajax({
                url:'http://localhost:8080/checkin/add',
                headers: {
                    token: localStorage.getItem("token")
                },
                data:data.field,
                type:'post',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('token', localStorage.getItem("token"));
                },
                success:function(result){
                    console.log(data);
                    if(result.code==0){
                        layer.msg(result.msg,{icon:1,time:1000},function(){
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.location.reload(); //数据刷新
                        });
                    }else{
                        console.log(result);
                        layer.msg(result.msg,{icon:2,time:1000});
                    }
                }
            })

            console.log(localStorage.getItem("token"))
            return false;
        });
    })
</script>
<script>
</script>
</body>
</html>